#include <stc89c5xrc.h>
#include "Init.h"
#include "Delay.h"

unsigned char keyScan(void)
{
	unsigned char num = 0;
	if(0 == KeyS2)
	{
		Delayms(10);
		if(0 == KeyS2)
		{
			while(!KeyS2)
			{
				num = 2;			
			}
		}
	}
	if(0 == KeyS3)
	{
		Delayms(10);
		if(0 == KeyS3)
		{
			while(!KeyS3)
			{
				num = 3;			
			}
		}
	}
	if(0 == KeyS4)
	{
		Delayms(10);
		if(0 == KeyS4)
		{
			while(!KeyS4)
			{
				num = 4;			
			}
		}
	}
	if(0 == KeyS5)
	{
		Delayms(10);
		if(0 == KeyS4)
		{
			while(!KeyS4)
			{
				num = 5;			
			}
		}
	}
	return num;
}
